Skip to content

Conversation

@davemarco
Copy link
Contributor

@davemarco davemarco commented Jul 21, 2025

Description

Converts webui to npm workspace, and modifies taskfiles to deal with node modules in root and packages.

npm workspace allows us to install dependencies in common, like typebox, allowing for more shared types between client and server.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Package starts, and webui can compress and search logs.

Summary by CodeRabbit

  • New Features

    • Added a shared web UI "common" package with build, lint, and workspace integration.
  • Bug Fixes

    • Fixed server static path resolution to improve startup and asset serving reliability.
  • Chores

    • Renamed/scoped packages, updated dependencies/devDependencies, removed legacy path aliases, adjusted TypeScript/Vite/ESLint configs, migrated imports to the new common package, and expanded build/packaging and checksum orchestration to include common node_modules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 21, 2025

Walkthrough

Adds a new workspace package @webui/common, migrates many type-only imports from local/relative/alias paths to @webui/common, updates client/server package manifests and workspace scripts, removes local TS/Vite @common aliases, corrects launcher server/dist paths, and includes common in build/pack checksum and taskfile flows.

Changes

Cohort / File(s) Summary
Introduce @webui/common package
components/webui/common/package.json, components/webui/common/tsconfig.json, components/webui/common/eslint.config.mjs, components/webui/common/src/index.ts
Add new workspace package @webui/common with exports, strict TS config, ESLint config, build/lint scripts; export new TestTypeBoxSchema and add QueryId to exported types.
Client: manifest, imports, config
components/webui/client/package.json, components/webui/client/tsconfig/tsconfig.app.json, components/webui/client/vite.config.ts, components/webui/client/src/...
Rename package to @webui/client, add dependency on @webui/common, bump deps/devDeps, remove local ../common from TS includes and Vite @common alias/server.fs allow; update many type-only imports to @webui/common.
Server: manifest, imports, scripts, paths
components/webui/server/package.json, components/webui/server/tsconfig.json, components/webui/server/src/..., components/webui/server/src/routes/static.ts
Rename to @webui/server, add @webui/common dependency, move TypeScript to devDependencies, update start/dev/standalone scripts to use dist/src/* (was dist/server/*), remove @common TS paths/include, migrate many imports to @webui/common, adjust static root dirname (one fewer parent).
Launcher path corrections
components/clp-package-utils/clp_package_utils/scripts/start_clp.py
Fix start_webui() constants: server_settings_json_path → .../webui/server/dist/settings.json and node_cmd → .../webui/server/dist/src/main.js (remove extra server segment).
Workspace orchestration
components/webui/package.json
Add workspaces ["common","client","server"]; convert init and lint scripts to workspace-aware commands; add dev concurrency scripts; bump concurrently devDependency; remove per-package root scripts.
Build/packaging: include common in checksums and packaging
taskfile.yaml
Add G_WEBUI_COMMON_NODE_MODULES_CHECKSUM_FILE; include common in node_modules checksum compute/validate and packaging flows; add COMMON_OUTPUT_DIR and adjust rsync/build/clean/pack steps to handle common; parallelize checksum orchestration.
Socket / Mongo types import updates
components/webui/client/src/api/socket/*, components/webui/server/src/plugins/app/socket/*
Replace deep relative or old @common imports with @webui/common for socket event and QueryId/Response types (MongoSocketCollection, MongoSocketCursor, SocketSingleton, MongoWatcherCollection, typings).
Search / Presto type imports & routes
components/webui/client/src/pages/SearchPage/**, components/webui/server/src/routes/api/*, components/webui/server/src/plugins/app/Presto.ts
Switch imports of signals, types, and engine constants (SEARCH_SIGNAL, PRESTO_SEARCH_SIGNAL, CLP_QUERY_ENGINES, PrestoSearchResult, SearchResultsMetadataDocument, PrestoRowObject) to @webui/common.
Static & config path adjustments
components/webui/server/src/routes/static.ts, components/webui/client/src/config/index.ts
Adjust static root dirname resolution (one fewer ..) and update CLP_QUERY_ENGINES import to @webui/common.
ESLint adjustments
components/webui/server/eslint.config.mjs
Remove yscope-log-viewer/dist/ and client/dist/ from ESLint ignore so those directories are linted.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer
  participant Repo as Repository
  participant Common as @webui/common
  participant Client as @webui/client
  participant Server as @webui/server
  participant Launcher as start_clp.py

  Note over Dev,Repo: add common workspace, migrate type imports, update manifests, packaging, and launcher paths
  Dev->>Repo: add components/webui/common (package, tsconfig, eslint, src)
  Dev->>Client: update manifest, remove TS/Vite @common alias, change type imports -> @webui/common
  Dev->>Server: update manifest/scripts to dist/src/*, remove TS paths, change imports -> @webui/common
  Client->>Common: import types/schemas (ClientToServerEvents, Presto types, SEARCH_SIGNAL)
  Server->>Common: import signals/types (SEARCH_SIGNAL, QueryId, engine constants)
  Launcher->>Server: execute corrected node command: node dist/src/main.js
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • junhaoliao
  • hoophalab

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3039ab1 and 5e148d1.

📒 Files selected for processing (1)
  • taskfile.yaml (10 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: junhaoliao
PR: y-scope/clp#1119
File: taskfile.yaml:429-433
Timestamp: 2025-08-14T18:23:39.476Z
Learning: In the webui workspace, the exclude patterns ".tmp" and ".vite-temp" are Vite-specific temporary directories that only apply to the client package. The common and server packages use TypeScript compiler (tsc) directly and don't generate these Vite temporary files, so these exclude patterns should not be applied to their node_modules checksum computations.
📚 Learning: 2025-08-19T18:14:01.607Z
Learnt from: davemarco
PR: y-scope/clp#1119
File: taskfile.yaml:302-305
Timestamp: 2025-08-19T18:14:01.607Z
Learning: npm ci in workspaces can work without physical package.json files in all workspace directories if the workspace information is properly defined in package-lock.json. Built static assets (like from Vite builds) don't require runtime package.json files since they're self-contained. npm ci uses the lockfile for dependency resolution, not individual workspace manifests.

Applied to files:

  • taskfile.yaml
📚 Learning: 2025-08-14T18:23:39.476Z
Learnt from: junhaoliao
PR: y-scope/clp#1119
File: taskfile.yaml:429-433
Timestamp: 2025-08-14T18:23:39.476Z
Learning: In the webui workspace, the exclude patterns ".tmp" and ".vite-temp" are Vite-specific temporary directories that only apply to the client package. The common and server packages use TypeScript compiler (tsc) directly and don't generate these Vite temporary files, so these exclude patterns should not be applied to their node_modules checksum computations.

Applied to files:

  • taskfile.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (14)
  • GitHub Check: ubuntu-jammy-lint
  • GitHub Check: ubuntu-jammy-dynamic-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-dynamic-linked-bins
  • GitHub Check: ubuntu-jammy-static-linked-bins
  • GitHub Check: musllinux_1_2-x86_64-static-linked-bins
  • GitHub Check: centos-stream-9-static-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-dynamic-linked-bins
  • GitHub Check: centos-stream-9-dynamic-linked-bins
  • GitHub Check: manylinux_2_28-x86_64-static-linked-bins
  • GitHub Check: lint-check (macos-15)
  • GitHub Check: lint-check (ubuntu-24.04)
  • GitHub Check: build-macos (macos-15, true)
  • GitHub Check: build (macos-15)
  • GitHub Check: build-macos (macos-15, false)
🔇 Additional comments (10)
taskfile.yaml (10)

41-41: LGTM: checksum var added for common

Properly introduces G_WEBUI_COMMON_NODE_MODULES_CHECKSUM_FILE and is wired later.


88-88: LGTM: clean step covers common/node_modules

Keeps parity with other workspace packages.


269-269: LGTM: webui sources include common checksum

Ensures rebuilds trigger correctly when common’s node_modules change.


301-303: LGTM: server/package.json and root manifests copied

Matches the workspace layout expected by npm ci in the packaged webui.


355-361: LGTM: helpful note on five node_modules dirs

The comment accurately documents the checksum scope.


367-367: LGTM: COMMON_OUTPUT_DIR var

Consistent with other OUTPUT_DIR vars.


375-377: LGTM: consolidated sources globs

Brace globs for package.json and package-lock.json across packages are correct and keep sources concise.


380-381: LGTM: generates includes common checksum

Ensures checksum files are produced for all tracked node_modules, including common.


395-398: LGTM: common checksum validate without Vite excludes

Correctly omits .tmp/.vite-temp for common per prior guidance.


422-426: LGTM: common checksum compute

Consistent with validate step; no Vite-specific excludes applied to common.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco changed the title feat(webui): Combine server, client, and common into npm workspace; restructure taskfile to use new workspace feat(webui): Combine server, client, and common into npm workspace; restructure taskfile to use new workspace. Jul 21, 2025
Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review on the draft

Comment on lines +6 to +8
"common",
"client",
"server"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to put those under a packages/ directory? this seems to be the recommendation in the npm docs and a commonly used conventions in many projects.

Suggested change
"common",
"client",
"server"
"packages/common",
"packages/client",
"packages/server"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a preference, i dont mind changing but maybe in a different PR so we dont need to modify the taskfile that much in this pr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we specify a components/webui/.npmrc file with

install-strategy = "nested"

("linked" might also work just fine though the command like to give a warning to say it might have bugs)

we can remove the init script in this file. any npm command like npm install and npm clean-install should install the node_modules inside the packages' own directory.

most importantly, the webui node_modules install task in taskfile.yaml will be much simplified

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this and it dosent seem to actually install the node_modules in the packages directory.

Copy link
Member

@junhaoliao junhaoliao Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to get this install-strategy config into effect, we need to clean the existing node_modules and package-lock.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know if this will keep nested package.lock? it if it dosent we still run into the same problem where we only have one lock file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i remember individual packages will have their own locks. this is fine to skip for now given the current structure already works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were not neccesary

@davemarco davemarco marked this pull request as ready for review August 11, 2025 17:01
@davemarco davemarco requested a review from a team as a code owner August 11, 2025 17:01
@davemarco
Copy link
Contributor Author

@junhaoliao - there was an issue with the linter script due to workspaces, i believe i just fixed

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
components/webui/package.json (2)

5-9: Workspaces list looks fine; note on directory convention (already discussed).

The explicit list is OK. Prior feedback about moving under packages/ remains a style preference and can be deferred as agreed.


11-11: Prefer deterministic installs with npm ci.

Replace clean-install with ci for lockfile-only reproducible installs across workspaces.

Apply this diff:

-    "init": "npm clean-install --workspaces",
+    "init": "npm ci --workspaces",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0ca50ed and 9741b66.

📒 Files selected for processing (1)
  • components/webui/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T18:14:01.607Z
Learnt from: davemarco
PR: y-scope/clp#1119
File: taskfile.yaml:302-305
Timestamp: 2025-08-19T18:14:01.607Z
Learning: npm ci in workspaces can work without physical package.json files in all workspace directories if the workspace information is properly defined in package-lock.json. Built static assets (like from Vite builds) don't require runtime package.json files since they're self-contained. npm ci uses the lockfile for dependency resolution, not individual workspace manifests.

Applied to files:

  • components/webui/package.json
🔇 Additional comments (1)
components/webui/package.json (1)

14-14: Update root “start” script to invoke workspace start commands

The top-level “client:start” and “server:start” composites were removed—each package now exposes its own start script. We’ve verified that:

  • @webui/client defines start: “vite”
  • @webui/server defines start: “npm run build && fastify start -l info dist/src/app.js”

Adjust the root components/webui/package.json accordingly:

--- a/components/webui/package.json
+++ b/components/webui/package.json
@@ lines 14
-    "start": "concurrently \"npm run client:start\" \"npm run server:start\""
+    "start": "concurrently \"npm --workspace @webui/client run start\" \"npm --workspace @webui/server run start\""

This ensures npm start correctly spins up both client and server via their workspace scripts.

Comment on lines 2 to 3
"name": "webui",
"version": "0.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Optional: align root package name with the scope used elsewhere.

Consider renaming to @webui/webui for consistency with @webui/client and @webui/server. Non-blocking.

🤖 Prompt for AI Agents
In components/webui/package.json around lines 2 to 3, the package name "webui"
is inconsistent with the scoped names used elsewhere; change the "name" field to
"@webui/webui" and update any local references (workspaces, import paths,
README, CI/publish config) to the new scoped name so tooling and dependency
resolution remain correct; ensure package.json's other fields
(private/publishConfig) are adjusted if necessary for publishing under the
scope.

Comment on lines 12 to 13
"lint:check": "npm --workspace common run build && npm run lint:check --workspaces",
"lint:fix": "npm --workspace common run build && npm run lint:fix --workspaces",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Harden lint scripts and address coupling to folder name.

  • Use workspace selector by package name (stable) instead of folder path "common".
  • Add --if-present so packages without the script don’t error.

Apply this diff:

-    "lint:check": "npm --workspace common run build && npm run lint:check --workspaces",
-    "lint:fix": "npm --workspace common run build && npm run lint:fix --workspaces",
+    "lint:check": "npm --workspace @webui/common run build && npm run --workspaces --if-present lint:check",
+    "lint:fix": "npm --workspace @webui/common run build && npm run --workspaces --if-present lint:fix",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"lint:check": "npm --workspace common run build && npm run lint:check --workspaces",
"lint:fix": "npm --workspace common run build && npm run lint:fix --workspaces",
"lint:check": "npm --workspace @webui/common run build && npm run --workspaces --if-present lint:check",
"lint:fix": "npm --workspace @webui/common run build && npm run --workspaces --if-present lint:fix",
🤖 Prompt for AI Agents
In components/webui/package.json around lines 12 to 13, the lint scripts are
hard-coded to the workspace folder name "common" and don't use --if-present;
change them to target the workspace by package name and add --if-present so
missing scripts won't fail. Replace "npm --workspace common run build" with "npm
--workspace=\"<package-name>\" --if-present run build" and append "--if-present"
to the downstream npm run calls (e.g. "npm run lint:check --workspaces
--if-present" and "npm run lint:fix --workspaces --if-present"); set
<package-name> to the actual package name for the common package as declared in
the root package.json.

Copy link
Member

@junhaoliao junhaoliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the PR title, how about

feat(webui): Migrate to npm workspace; Update taskfile and the package scripts accordingly.

"init": "npm clean-install --workspaces",
"lint:check": "npm --workspace common run build && npm run lint:check --workspaces",
"lint:fix": "npm --workspace common run build && npm run lint:fix --workspaces",
"start": "concurrently \"npm run client:start\" \"npm run server:start\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's fix this broken script

i believe a more elegant way is possible once we unify the dev script names, for now this

Suggested change
"start": "concurrently \"npm run client:start\" \"npm run server:start\""
"start": "concurrently \"npm run start:*\"",
"start:client": "npm --workspace client run start",
"start:common": "npm --workspace common run build:watch",
"start:server": "npm --workspace server run dev"

also we should update the concurrently version to match the server's version (see below). otherwise, concurrently won't be installed due to version conflict.

    "concurrently": "^9.1.2"

then

rm -rf node_modules package-lock.json
npm i --workspaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i used dev instead since i think better than start. I dont think i need to remove, i think i can just write npm i --save-dev [email protected]

@davemarco davemarco changed the title feat(webui): Combine server, client, and common into npm workspace; restructure taskfile to use new workspace. feat(webui): Migrate to npm workspace; Update taskfile and the package scripts accordingly. Aug 28, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (5)
components/webui/client/tsconfig/tsconfig.app.json (1)

4-4: Include glob looks correct; resolves prior ask.

Using "../src/**/*" is the right scope for the app TS inputs and aligns with removing the old @common alias.

components/webui/package.json (2)

14-14: Start script is broken; invoke package starts via workspace selectors.

Root no longer has client:start/server:start. Call each package’s start directly.

-    "start": "concurrently \"npm run client:start\" \"npm run server:start\""
+    "start": "concurrently \"npm --workspace @webui/client run start\" \"npm --workspace @webui/server run start\""

5-9: Optional: pin concurrently to match other packages and avoid version conflicts.

If server/common use concurrently 9.x, align here to prevent dedupe churn. Non-blocking.

-    "concurrently": "^8.2.2"
+    "concurrently": "^9.1.2"
components/webui/client/package.json (2)

2-2: Mark app package as private to prevent accidental publish.

 {
-  "name": "@webui/client",
+  "name": "@webui/client",
+  "private": true,

24-24: Replace wildcard on @webui/common with a pinned workspace version.

"*" harms reproducibility and can pull a registry artefact if it ever exists. Pin to common’s version.

-    "@webui/common": "*",
+    "@webui/common": "^0.1.0",

Adjust the version to match components/webui/common/package.json if different.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9741b66 and 44451b7.

📒 Files selected for processing (3)
  • components/webui/client/package.json (3 hunks)
  • components/webui/client/tsconfig/tsconfig.app.json (1 hunks)
  • components/webui/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T18:14:01.607Z
Learnt from: davemarco
PR: y-scope/clp#1119
File: taskfile.yaml:302-305
Timestamp: 2025-08-19T18:14:01.607Z
Learning: npm ci in workspaces can work without physical package.json files in all workspace directories if the workspace information is properly defined in package-lock.json. Built static assets (like from Vite builds) don't require runtime package.json files since they're self-contained. npm ci uses the lockfile for dependency resolution, not individual workspace manifests.

Applied to files:

  • components/webui/package.json
🔇 Additional comments (2)
components/webui/client/package.json (2)

21-21: Good: synced @sinclair/typebox with common.


46-47: Tooling versions look stable and aligned.

Comment on lines +11 to +13
"init": "npm clean-install --workspaces && npm --workspace common run build",
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Prefer lockfile-only installs and target the workspace by package name.

Use npm ci for reproducible installs and refer to @webui/common by package name (not folder).

-    "init": "npm clean-install --workspaces && npm --workspace common run build",
+    "init": "npm ci --workspaces && npm --workspace @webui/common run build",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"init": "npm clean-install --workspaces && npm --workspace common run build",
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
// components/webui/package.json
{
// …
"scripts": {
"init": "npm ci --workspaces && npm --workspace @webui/common run build",
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
// …
}
// …
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
components/webui/package.json (3)

5-9: Workspace layout: prior suggestion still stands (packages/ or globs).

Using folder names is fine, but adopting a packages/ directory and/or a glob (e.g., "packages/*") is the common convention and scales better. Non-blocking.


11-11: Use lockfile-only installs and target the workspace by package name.

Deterministic installs via npm ci; address coupling to folder name.

-    "init": "npm clean-install --workspaces && npm --workspace common run build",
+    "init": "npm ci --workspaces && npm --workspace @webui/common run build",

Note: Based on the retrieved learnings for this repo, npm ci works well with workspaces and lockfile-driven resolution.


14-14: Fix start script to actually target workspace packages.

client:start/server:start aren’t root scripts; current command will fail. Use npm’s workspace selector.

-    "start": "concurrently \"npm run client:start\" \"npm run server:start\""
+    "start": "concurrently \"npm -w @webui/client run start\" \"npm -w @webui/server run start\""
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 44451b7 and 4026fe9.

⛔ Files ignored due to path filters (1)
  • components/webui/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • components/webui/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T18:14:01.607Z
Learnt from: davemarco
PR: y-scope/clp#1119
File: taskfile.yaml:302-305
Timestamp: 2025-08-19T18:14:01.607Z
Learning: npm ci in workspaces can work without physical package.json files in all workspace directories if the workspace information is properly defined in package-lock.json. Built static assets (like from Vite builds) don't require runtime package.json files since they're self-contained. npm ci uses the lockfile for dependency resolution, not individual workspace manifests.

Applied to files:

  • components/webui/package.json
🔇 Additional comments (1)
components/webui/package.json (1)

19-19: concurrently version bump aligns with server; LGTM.

Comment on lines +12 to +13
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Harden lint scripts; add --if-present and correct flag placement.

Prevents failures when some packages lack lint scripts and uses the supported flag order.

-    "lint:check": "npm run lint:check --workspaces",
-    "lint:fix": "npm run lint:fix --workspaces",
+    "lint:check": "npm --workspaces run --if-present lint:check",
+    "lint:fix": "npm --workspaces run --if-present lint:fix",

If type-aware linting needs built types, consider prepending: npm -w @webui/common run build.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
"lint:check": "npm --workspaces run --if-present lint:check",
"lint:fix": "npm --workspaces run --if-present lint:fix",
🤖 Prompt for AI Agents
In components/webui/package.json around lines 12-13, the lint scripts should
include the --if-present option and place the flags before the run command;
change them to run with flags first (e.g., npm --workspaces --if-present run
lint:check and npm --workspaces --if-present run lint:fix) so npm won't fail if
some workspaces lack the scripts and the flag order is valid; if type-aware
linting requires built types, optionally prepend an npm -w @webui/common run
build step.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/webui/server/package.json (1)

19-19: Optionally declare Node engine.
Helps CI and devs align with Node 22.

   "type": "module",
+  "engines": {
+    "node": ">=22 <23"
+  },
♻️ Duplicate comments (4)
components/webui/server/package.json (2)

8-12: Fix compiled path: TypeScript emits to dist/, not dist/src.
Update script targets or builds will fail to start.

Apply:

-    "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/src/app.js",
+    "dev:start": "fastify start --ignore-watch=.ts$ -w -l info -P dist/app.js",
-    "start": "npm run build && fastify start -l info dist/src/app.js",
+    "start": "npm run build && fastify start -l info dist/app.js",
-    "standalone": "npm run build && node --env-file=.env dist/src/main.js",
+    "standalone": "npm run build && node --env-file=.env dist/main.js",
#!/bin/bash
# Inspect TS config to confirm emit layout
sed -n '1,200p' components/webui/server/tsconfig.json | sed -n '1,120p'
rg -nP '"(outDir|rootDir)"' components/webui/server/tsconfig.json || true
# Check entry sources exist
rg -n 'src/(app|main)\.ts' components/webui/server -S -C1 || true

34-34: Move @types/node to devDependencies.
Avoids bundling types at runtime (see #1116).

   "dependencies": {
-    "@types/node": "^22.13.9",
   },
   "devDependencies": {
+    "@types/node": "^22.13.9",
   }
components/webui/package.json (2)

11-11: Use lockfile-only installs and target workspace by package name.
More reproducible; decouples from folder names.

-    "init": "npm clean-install --workspaces && npm --workspace common run build",
+    "init": "npm ci --workspaces && npm -w @webui/common run build",

12-13: Harden lint scripts; add --if-present and correct flag order.
Prevents failures if a package lacks lint scripts.

-    "lint:check": "npm run lint:check --workspaces",
-    "lint:fix": "npm run lint:fix --workspaces",
+    "lint:check": "npm --workspaces run --if-present lint:check",
+    "lint:fix": "npm --workspaces run --if-present lint:fix",
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bb868d9 and 5873146.

⛔ Files ignored due to path filters (1)
  • components/webui/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • components/webui/package.json (1 hunks)
  • components/webui/server/package.json (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T18:14:01.607Z
Learnt from: davemarco
PR: y-scope/clp#1119
File: taskfile.yaml:302-305
Timestamp: 2025-08-19T18:14:01.607Z
Learning: npm ci in workspaces can work without physical package.json files in all workspace directories if the workspace information is properly defined in package-lock.json. Built static assets (like from Vite builds) don't require runtime package.json files since they're self-contained. npm ci uses the lockfile for dependency resolution, not individual workspace manifests.

Applied to files:

  • components/webui/package.json
  • components/webui/server/package.json
🔇 Additional comments (6)
components/webui/server/package.json (4)

2-2: Package rename—LGTM.
Scoped name matches the workspace.


33-33: TypeBox version bump—LGTM.
Matches prior suggestion.


35-35: Workspace dep on @webui/common—LGTM.
Using "*" with npm workspaces resolves to the local package.


47-51: Tooling bumps—LGTM.
Pinned eslint config, updated concurrently, tap, and typescript are reasonable.

components/webui/package.json (2)

5-9: Workspaces declaration—LGTM.
Simple, clear layout for common/client/server.


22-22: concurrently ^9.2.1—LGTM.
Matches server’s version; resolves the install conflict noted earlier.

Comment on lines 2 to 4
"name": "webui",
"version": "0.1.0",
"description": "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Mark root as private and (optionally) add Node engine.
Prevents accidental publish; documents required Node.

   "name": "webui",
   "version": "0.1.0",
   "description": "",
+  "private": true,
+  "engines": { "node": ">=22 <23" },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"name": "webui",
"version": "0.1.0",
"description": "",
"name": "webui",
"version": "0.1.0",
"description": "",
"private": true,
"engines": { "node": ">=22 <23" },
// … the rest of your existing fields …
🤖 Prompt for AI Agents
In components/webui/package.json around lines 2 to 4, the package.json is
missing the "private": true flag (and optionally an engines field) which allows
accidental publish and doesn't document Node requirements; add "private": true
at the top-level (e.g., immediately after "version") to prevent publishing, and
optionally add an "engines" entry such as "engines": { "node": ">=16" } (or your
supported range) to document the required Node version.

Comment on lines 14 to 17
"dev": "concurrently --raw \"npm run dev:*\"",
"dev:client": "npm --workspace client run start",
"dev:common": "npm --workspace common run build:watch",
"dev:server": "npm --workspace server run dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Select workspaces by package name, not folder.
More robust to renames and matches scoped package IDs.

-    "dev": "concurrently --raw \"npm run dev:*\"",
-    "dev:client": "npm --workspace client run start",
-    "dev:common": "npm --workspace common run build:watch",
-    "dev:server": "npm --workspace server run dev"
+    "dev": "concurrently --raw \"npm run dev:*\"",
+    "dev:client": "npm -w @webui/client run start",
+    "dev:common": "npm -w @webui/common run build:watch",
+    "dev:server": "npm -w @webui/server run dev"

🏁 Script executed:

#!/bin/bash
# Verify workspace package names exist
rg -nP '^\s*"name":\s*"@webui/(client|common|server)"' -S components/webui -C1

Length of output: 1169


Use workspace package names for run scripts
Verified that @webui/client, @webui/common and @webui/server exist; you may optionally switch to npm -w @webui/<pkg> (e.g. npm -w @webui/client run start) for greater resilience to folder renames.

🤖 Prompt for AI Agents
In components/webui/package.json around lines 14 to 17, the dev scripts use
workspace folder names (npm --workspace client/common/server ...) which can
break if folders are renamed; update the scripts to use workspace package names
with npm -w @webui/client run start, npm -w @webui/common run build:watch and
npm -w @webui/server run dev respectively so the commands target the package by
its workspace name rather than the folder path.

"name": "@webui/server",
"version": "0.1.0",
"description": "",
"main": "src/main.ts",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Nit: point “main” to built output (or drop it).
As an app, either set dist/main.js or omit “main”.

-  "main": "src/main.ts",
+  "main": "dist/main.js",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"main": "src/main.ts",
"main": "dist/main.js",
🤖 Prompt for AI Agents
In components/webui/server/package.json around line 5, the "main" field points
to the TypeScript source ("src/main.ts") which is incorrect for a
published/built app; update the field to the built output (e.g., "dist/main.js")
or remove the "main" entry entirely if you don't need it, and ensure your build
script outputs to the referenced path (or adjust the build output path
accordingly) so the package.json points to the actual runtime artifact.

@davemarco davemarco requested a review from junhaoliao August 28, 2025 17:05
junhaoliao
junhaoliao previously approved these changes Aug 28, 2025
"init": "npm clean-install --workspaces && npm --workspace common run build",
"lint:check": "npm run lint:check --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
"dev": "concurrently --raw \"npm run dev:*\"",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq: any reason we want "raw"? were the logs a bit clustered without --raw?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was playing around with console printing. this one i can remove. I also added --preserveWatchOutput fyi, since it was annoying that tsc would keep clearing terminal

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. i've been finding that annoying as well

@davemarco davemarco requested a review from junhaoliao August 28, 2025 20:18
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/utils.ts (2)

14-18: Simplify the guard with optional chaining; drop brittle typeof checks.

Current checks are redundant and rely on string "undefined". Prefer a single nullish check.

Apply:

-    if (0 === data.length ||
-        "undefined" === typeof data[0] ||
-        "undefined" === typeof data[0].row
-    ) {
-        return [];
-    }
+    const firstRow = data[0]?.row;
+    if (undefined === firstRow) {
+        return [];
+    }

21-30: Consider stable column ordering.

If server/object key insertion order isn’t guaranteed, sort keys for deterministic column layout. Skip if order is intentionally meaningful.

-    return Object.keys(data[0].row)
-        .map((key) => ({
+    const keys = Object.keys(firstRow).sort();
+    return keys.map((key) => ({
             dataIndex: [
                 "row",
                 key,
             ],
             key: key,
             title: key,
             width: 100,
         }));
♻️ Duplicate comments (5)
components/webui/client/package.json (3)

2-3: Mark the app package as private to prevent accidental publish.

 {
   "name": "@webui/client",
+  "private": true,
   "version": "0.1.0",

24-24: Replace "*" with a pinned workspace version for @webui/common.
Using "*" hurts reproducibility and could pull a registry copy if one appears. Pin to the version declared in components/webui/common/package.json.

-    "@webui/common": "*",
+    "@webui/common": "^0.1.0",

49-49: Vite ^6.3.5 — confirm against prior “revert” request; consider pinning exact.
If we keep 6.3.5, prefer exact pin to reduce churn and ensure plugin parity.

-    "vite": "^6.3.5"
+    "vite": "6.3.5"
components/clp-package-utils/clp_package_utils/scripts/start_clp.py (2)

845-847: Path fix to server/dist/settings.json is correct; ensure the build copies settings.json into dist

The runtime expects server/dist/settings.json, but tsc won’t emit JSON. Add an assets copy step to the server build to prevent a 404 at startup.

Apply in components/webui/server/package.json:

 {
   "scripts": {
-    "build": "tsc"
+    "build": "tsc && mkdir -p dist && cp src/settings.json dist/settings.json"
   }
 }

Quick check after building:

#!/bin/bash
# Verify server settings.json is emitted to dist
test -f components/webui/server/dist/settings.json && echo "OK: settings.json present" || (echo "Missing: components/webui/server/dist/settings.json"; exit 1)

965-968: Entrypoint updated to dist/src/main.js; verify build emits it and fail fast if missing

Many tsconfig setups output dist/main.js (rootDir: "src"). Either adjust tsconfig or the path, and add a host-side existence check for clearer errors.

Option A — keep dist/src/main.js: set rootDir to "." in components/webui/server/tsconfig.json.

 {
   "compilerOptions": {
-    "rootDir": "src",
+    "rootDir": ".",
     "outDir": "dist"
   }
 }

Option B — if you prefer dist/main.js, change the Python path back accordingly.

Also add a preflight check in this script:

     node_cmd = [
         str(CONTAINER_CLP_HOME / "bin" / "node-22"),
-        str(container_webui_dir / "server" / "dist" / "src" / "main.js"),
+        str(container_webui_dir / "server" / "dist" / "src" / "main.js"),
     ]
+    # Fail fast if entrypoint is missing on host
+    main_js_host_path = (
+        get_clp_home() / "var" / "www" / "webui" / "server" / "dist" / "src" / "main.js"
+    )
+    if not main_js_host_path.exists():
+        raise FileNotFoundError(
+            f"WebUI server entrypoint not found at {main_js_host_path}. "
+            "Build the server package before starting (e.g., `task webui:build` or `npm -w components/webui/server run build`)."
+        )

Quick check after building:

#!/bin/bash
# Verify server entrypoint exists
test -f components/webui/server/dist/src/main.js && echo "OK: main.js present" || (echo "Missing: components/webui/server/dist/src/main.js"; exit 1)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3fee734 and 3039ab1.

⛔ Files ignored due to path filters (1)
  • components/webui/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • components/clp-package-utils/clp_package_utils/scripts/start_clp.py (2 hunks)
  • components/webui/client/package.json (3 hunks)
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/index.tsx (1 hunks)
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}

⚙️ CodeRabbit configuration file

  • Prefer false == <expression> rather than !<expression>.

Files:

  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/utils.ts
  • components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/index.tsx
🧠 Learnings (1)
📓 Common learnings
Learnt from: junhaoliao
PR: y-scope/clp#1119
File: taskfile.yaml:429-433
Timestamp: 2025-08-14T18:23:39.476Z
Learning: In the webui workspace, the exclude patterns ".tmp" and ".vite-temp" are Vite-specific temporary directories that only apply to the client package. The common and server packages use TypeScript compiler (tsc) directly and don't generate these Vite temporary files, so these exclude patterns should not be applied to their node_modules checksum computations.
🧬 Code graph analysis (1)
components/clp-package-utils/clp_package_utils/scripts/start_clp.py (1)
components/clp-package-utils/clp_package_utils/general.py (1)
  • get_clp_home (109-125)
🔇 Additional comments (5)
components/webui/client/package.json (2)

21-21: Aligned TypeBox to ^0.34.38 — good.


47-47: Pinning eslint-config-yscope is correct — avoids CI drift.

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/index.tsx (2)

50-51: Verify rowKey compatibility with the centralised type.

Ensure PrestoSearchResult in @webui/common guarantees a unique string/number _id; otherwise VirtualTable row identity may break.


6-6: Type import migration to @webui/common verified
PrestoSearchResult is exported in @webui/common with both _id and row as expected; no further action required.

components/webui/client/src/pages/SearchPage/SearchResults/SearchResultsTable/Presto/PrestoResultsVirtualTable/utils.ts (1)

1-1: Type import switch to @webui/common is correct.

Matches the workspace type centralisation; no behavioural change.

"eslint-config-yscope": "latest",
"typescript": "~5.6.2",
"eslint-config-yscope": "1.1.1",
"typescript": "~5.7.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Confirm TS version alignment across workspace.
Ensure all packages use the same operator (~5.7.3) to avoid duplicate installs.


🏁 Script executed:

#!/bin/bash
rg -n --hidden --glob '!node_modules' -e '"typescript"\s*:\s*"[^"]+"' -g '*package.json' -C1

Length of output: 667


Align TypeScript specifier across all packages
In components/webui/common/package.json and components/webui/server/package.json, change

"typescript": "^5.7.3"

to

"typescript": "~5.7.3"

so all workspaces use the same operator and avoid duplicate installs.

🤖 Prompt for AI Agents
In components/webui/client/package.json around line 48, update the TypeScript
dependency specifier to match the other webui packages: change occurrences using
the caret operator to use the tilde operator so all workspaces declare
"typescript" with "~5.7.3" to ensure consistent versions and avoid duplicate
installs; modify the specifier in components/webui/common/package.json and
components/webui/server/package.json accordingly.

@davemarco davemarco merged commit bcf44ee into y-scope:main Sep 3, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants